package teaching.io.advance;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * 字节输入流到字符输入流的转换类的示例。
 * 
 * @author deng.zhao
 * @version 1.0 2018/03/28
 *
 */
public class InputStreamReaderExample {

	public static void main(String[] args) {
		try (InputStream is = new FileInputStream("d:/test.dat");
				InputStreamReader isr = new InputStreamReader(is);
				BufferedReader br = new BufferedReader(isr);) {

			String str = null;

			while ((str = br.readLine()) != null) {
				System.out.println(str);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e1) {
			e1.printStackTrace();
		}

		System.out.println("DONE!");
	}

}
